<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"vchao.top","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="需求普通的手机开发，可以做一个二维码扫码的页面，用zxing一类的可以轻松实现，但是，如果是大型的安卓系统的终端机的话，摄像头不方便使用。可以依靠扫码枪来实现类似的效果。 分析大型安卓设备与安卓手机的开发区别还是比较大的，尤其是扫码枪部分，有以下特点。例如：  终端机的开发中，经常是Activity 数量比较少，Fragment比较多。 扫码枪需要全局响应。并不只局限于某一个Fragment。 大">
<meta property="og:type" content="article">
<meta property="og:title" content="安卓扫码枪开发，拦截扫码事件">
<meta property="og:url" content="http://vchao.top/2021/08/25/%E5%AE%89%E5%8D%93%E6%89%AB%E7%A0%81%E6%9E%AA%E5%BC%80%E5%8F%91%EF%BC%8C%E6%8B%A6%E6%88%AA%E6%89%AB%E7%A0%81%E4%BA%8B%E4%BB%B6/index.html">
<meta property="og:site_name" content="乘风破浪">
<meta property="og:description" content="需求普通的手机开发，可以做一个二维码扫码的页面，用zxing一类的可以轻松实现，但是，如果是大型的安卓系统的终端机的话，摄像头不方便使用。可以依靠扫码枪来实现类似的效果。 分析大型安卓设备与安卓手机的开发区别还是比较大的，尤其是扫码枪部分，有以下特点。例如：  终端机的开发中，经常是Activity 数量比较少，Fragment比较多。 扫码枪需要全局响应。并不只局限于某一个Fragment。 大">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-08-25T14:42:51.177Z">
<meta property="article:modified_time" content="2021-08-25T14:37:20.803Z">
<meta property="article:author" content="vchao">
<meta property="article:tag" content="Android">
<meta property="article:tag" content="Android Studio">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://vchao.top/2021/08/25/%E5%AE%89%E5%8D%93%E6%89%AB%E7%A0%81%E6%9E%AA%E5%BC%80%E5%8F%91%EF%BC%8C%E6%8B%A6%E6%88%AA%E6%89%AB%E7%A0%81%E4%BA%8B%E4%BB%B6/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>安卓扫码枪开发，拦截扫码事件 | 乘风破浪</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">乘风破浪</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://vchao.top/2021/08/25/%E5%AE%89%E5%8D%93%E6%89%AB%E7%A0%81%E6%9E%AA%E5%BC%80%E5%8F%91%EF%BC%8C%E6%8B%A6%E6%88%AA%E6%89%AB%E7%A0%81%E4%BA%8B%E4%BB%B6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="vchao">
      <meta itemprop="description" content="怀揣好奇，梦想改变世界的菜鸟极客">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="乘风破浪">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          安卓扫码枪开发，拦截扫码事件
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-08-25 22:42:51 / 修改时间：22:37:20" itemprop="dateCreated datePublished" datetime="2021-08-25T22:42:51+08:00">2021-08-25</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Android/" itemprop="url" rel="index"><span itemprop="name">Android</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="需求"><a href="#需求" class="headerlink" title="需求"></a>需求</h2><p>普通的手机开发，可以做一个二维码扫码的页面，用zxing一类的可以轻松实现，但是，如果是大型的安卓系统的终端机的话，摄像头不方便使用。可以依靠扫码枪来实现类似的效果。</p>
<h2 id="分析"><a href="#分析" class="headerlink" title="分析"></a>分析</h2><p>大型安卓设备与安卓手机的开发区别还是比较大的，尤其是扫码枪部分，有以下特点。例如：</p>
<ul>
<li>终端机的开发中，经常是Activity 数量比较少，Fragment比较多。</li>
<li>扫码枪需要全局响应。并不只局限于某一个Fragment。</li>
<li>大多数扫码枪的原理是模拟键盘进行输入，所以不支持包含有汉字的二维码</li>
</ul>
<p>我这边使用是USB HID的扫码枪，即插即用，只需要在界面上有带有焦点的EditText ，就可以获取扫码枪扫描的内容。大多数扫码枪是模拟键盘进行输入，大多数时候需要使用获取焦点的 EditText 接收其扫描的信息。<br>显然这并不能满足我们的需求。那么，仔细想一下，我们可以认为是在短时间内，识别了二维码中的非汉字信息，并依次按键。我们可以在按键的时候进行按键事件 onKeyDown 的拦截。等全部扫描完毕之后，再去执行其它操作。</p>
<blockquote>
<p>USB HID扫码枪会将扫描出来的内容转化为键盘事件，对应的就是Android中的KeyEvent事件，所以我们只需要在我们的activity中重写onKeyDown方法，即可获取相应事件。</p>
</blockquote>
<h2 id="实现"><a href="#实现" class="headerlink" title="实现"></a>实现</h2><h3 id="找规律"><a href="#找规律" class="headerlink" title="找规律"></a>找规律</h3><p>既然我们要进行按键事件拦截，那么就得有一个明确的拦截开始时间和结束时间。可以先通过打印所有的keycode，来观察扫码后都执行了哪些按键。<br>例如我的扫码枪，在真正内容开始前和结束后，会按下一个keycode 值为 143 的按键。即 KEYCODE_NUM_LOCK    小键盘锁    。<br>那么可以设置一个布尔值，标识当前是否是扫描状态。并在结束的时候进行下一步操作。即：</p>
<blockquote>
<p>怎么进行下一步操作？方法太多了，EventBus，接口回调，方法，……</p>
</blockquote>
<figure class="highlight kotlin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> isScan = <span class="literal">false</span>;  <span class="comment">// 当前是否是扫描状态</span></span><br><span class="line">···</span><br><span class="line"><span class="keyword">if</span> (keyCode == KeyEvent.KEYCODE_NUM_LOCK) &#123;</span><br><span class="line">          <span class="keyword">if</span> (isScan) &#123;</span><br><span class="line">              LogUtils.e(<span class="string">&quot;String ==&gt;&quot;</span> + ScanString)</span><br><span class="line">              ScanString = <span class="string">&quot;&quot;</span></span><br><span class="line">          &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">              LogUtils.e(<span class="string">&quot;String ==&gt;&quot;</span> + <span class="string">&quot;开始扫描……&quot;</span>)</span><br><span class="line">          &#125;</span><br><span class="line">          isScan = !isScan</span><br><span class="line">          <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="keyword">if</span> (isScan) &#123;</span><br><span class="line">          ScanString += getInputCode(event).toString()</span><br><span class="line">          <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">      &#125;</span><br></pre></td></tr></table></figure>
<h3 id="拼接字符串"><a href="#拼接字符串" class="headerlink" title="拼接字符串"></a>拼接字符串</h3><p>只获取到了 keycode 值不行，还需要将keycode值转为具体的内容。</p>
<figure class="highlight kotlin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//获取扫描内容</span></span><br><span class="line"><span class="keyword">private</span> <span class="function"><span class="keyword">fun</span> <span class="title">getInputCode</span><span class="params">(event: <span class="type">KeyEvent</span>)</span></span>: <span class="built_in">Char</span> &#123;</span><br><span class="line">    <span class="keyword">val</span> keyCode = event.keyCode</span><br><span class="line">    <span class="keyword">val</span> aChar: <span class="built_in">Char</span></span><br><span class="line">    <span class="keyword">if</span> (keyCode &gt;= KeyEvent.KEYCODE_A &amp;&amp; keyCode &lt;= KeyEvent.KEYCODE_Z) &#123;</span><br><span class="line">        <span class="comment">//字母</span></span><br><span class="line">        aChar = ((<span class="string">&#x27;a&#x27;</span>).toInt() + keyCode - KeyEvent.KEYCODE_A).toChar()</span><br><span class="line">    &#125; <span class="keyword">else</span> <span class="keyword">if</span> (keyCode &gt;= KeyEvent.KEYCODE_0 &amp;&amp; keyCode &lt;= KeyEvent.KEYCODE_9) &#123;</span><br><span class="line">        <span class="comment">//数字</span></span><br><span class="line">        aChar = (<span class="string">&#x27;0&#x27;</span> + keyCode - KeyEvent.KEYCODE_0).toChar()</span><br><span class="line">    &#125; <span class="keyword">else</span> <span class="keyword">if</span> (keyCode == KeyEvent.KEYCODE_ENTER) &#123;</span><br><span class="line">        aChar = <span class="number">0.</span>toChar()</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        <span class="comment">//其他符号</span></span><br><span class="line">        aChar = event.unicodeChar.toChar()</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> aChar</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="代码"><a href="#代码" class="headerlink" title="代码"></a>代码</h2><figure class="highlight kotlin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> isScan = <span class="literal">false</span>;  <span class="comment">// 当前是否是扫描状态</span></span><br><span class="line"><span class="keyword">var</span> ScanString = <span class="string">&quot;&quot;</span>;  <span class="comment">// 扫描出的内容</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">override</span> <span class="function"><span class="keyword">fun</span> <span class="title">onKeyDown</span><span class="params">(keyCode: <span class="type">Int</span>, event: <span class="type">KeyEvent</span>)</span></span>: <span class="built_in">Boolean</span> &#123;</span><br><span class="line">    <span class="keyword">if</span> (keyCode == KeyEvent.KEYCODE_NUM_LOCK) &#123;</span><br><span class="line">        <span class="keyword">if</span> (isScan) &#123;</span><br><span class="line">            LogUtils.e(<span class="string">&quot;String ==&gt;&quot;</span> + ScanString)</span><br><span class="line">            ScanString = <span class="string">&quot;&quot;</span></span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            LogUtils.e(<span class="string">&quot;String ==&gt;&quot;</span> + <span class="string">&quot;开始扫描……&quot;</span>)</span><br><span class="line">        &#125;</span><br><span class="line">        isScan = !isScan</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (isScan) &#123;</span><br><span class="line">        ScanString += getInputCode(event).toString()</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">super</span>.onKeyDown(keyCode, event)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//获取扫描内容</span></span><br><span class="line"><span class="keyword">private</span> <span class="function"><span class="keyword">fun</span> <span class="title">getInputCode</span><span class="params">(event: <span class="type">KeyEvent</span>)</span></span>: <span class="built_in">Char</span> &#123;</span><br><span class="line">    <span class="keyword">val</span> keyCode = event.keyCode</span><br><span class="line">    <span class="keyword">val</span> aChar: <span class="built_in">Char</span></span><br><span class="line">    <span class="keyword">if</span> (keyCode &gt;= KeyEvent.KEYCODE_A &amp;&amp; keyCode &lt;= KeyEvent.KEYCODE_Z) &#123;</span><br><span class="line">        <span class="comment">//字母</span></span><br><span class="line">        aChar = ((<span class="string">&#x27;a&#x27;</span>).toInt() + keyCode - KeyEvent.KEYCODE_A).toChar()</span><br><span class="line">    &#125; <span class="keyword">else</span> <span class="keyword">if</span> (keyCode &gt;= KeyEvent.KEYCODE_0 &amp;&amp; keyCode &lt;= KeyEvent.KEYCODE_9) &#123;</span><br><span class="line">        <span class="comment">//数字</span></span><br><span class="line">        aChar = (<span class="string">&#x27;0&#x27;</span> + keyCode - KeyEvent.KEYCODE_0).toChar()</span><br><span class="line">    &#125; <span class="keyword">else</span> <span class="keyword">if</span> (keyCode == KeyEvent.KEYCODE_ENTER) &#123;</span><br><span class="line">        aChar = <span class="number">0.</span>toChar()</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        <span class="comment">//其他符号</span></span><br><span class="line">        aChar = event.unicodeChar.toChar()</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> aChar</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="安卓keycode列表"><a href="#安卓keycode列表" class="headerlink" title="安卓keycode列表"></a>安卓keycode列表</h2><p>详细列表 见  <a target="_blank" rel="noopener" href="https://blog.csdn.net/feizhixuan46789/article/details/16801429">https://blog.csdn.net/feizhixuan46789/article/details/16801429</a><br>此处简单总结一下keycode列表。</p>
<ul>
<li>0-9 对应的是 KEYCODE_0 - KEYCODE_9，真实的值为 7 - 16</li>
<li>A-Z 对应的是 KEYCODE_A - KEYCODE_Z ，值为 29 - 54</li>
<li>上下左右中  对应 19-23，</li>
<li>功能键如下：<br>KEYCODE_ENTER    回车键    66<br>KEYCODE_ESCAPE    ESC键    111<br>KEYCODE_DPAD_CENTER    导航键 确定键    23<br>KEYCODE_DPAD_UP    导航键 向上    19<br>KEYCODE_DPAD_DOWN    导航键 向下    20<br>KEYCODE_DPAD_LEFT    导航键 向左    21<br>KEYCODE_DPAD_RIGHT    导航键 向右    22<br>KEYCODE_MOVE_HOME    光标移动到开始键    122<br>KEYCODE_MOVE_END    光标移动到末尾键    123<br>KEYCODE_PAGE_UP    向上翻页键    92<br>KEYCODE_PAGE_DOWN    向下翻页键    93<br>KEYCODE_DEL    退格键    67<br>KEYCODE_FORWARD_DEL    删除键    112<br>KEYCODE_INSERT    插入键    124<br>KEYCODE_TAB    Tab键    61<br>KEYCODE_NUM_LOCK    小键盘锁    143<br>KEYCODE_CAPS_LOCK    大写锁定键    115<br>KEYCODE_BREAK    Break/Pause键    121<br>KEYCODE_SCROLL_LOCK    滚动锁定键    116<br>KEYCODE_ZOOM_IN    放大键    168<br>KEYCODE_ZOOM_OUT    缩小键    169</li>
</ul>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Android/" rel="tag"># Android</a>
              <a href="/tags/Android-Studio/" rel="tag"># Android Studio</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/08/25/%E5%AE%89%E5%8D%93%E6%88%AA%E5%B1%8F%E7%9B%91%E5%90%AC/" rel="prev" title="详细讲解安卓截屏监听操作">
      <i class="fa fa-chevron-left"></i> 详细讲解安卓截屏监听操作
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/08/25/%E5%AE%89%E5%8D%93%E7%9A%84%E5%8F%8C%E5%B1%8F%E5%BC%82%E6%98%BE/" rel="next" title="安卓的双屏异显">
      安卓的双屏异显 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%9C%80%E6%B1%82"><span class="nav-number">1.</span> <span class="nav-text">需求</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%86%E6%9E%90"><span class="nav-number">2.</span> <span class="nav-text">分析</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%9E%E7%8E%B0"><span class="nav-number">3.</span> <span class="nav-text">实现</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%89%BE%E8%A7%84%E5%BE%8B"><span class="nav-number">3.1.</span> <span class="nav-text">找规律</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%8B%BC%E6%8E%A5%E5%AD%97%E7%AC%A6%E4%B8%B2"><span class="nav-number">3.2.</span> <span class="nav-text">拼接字符串</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%A3%E7%A0%81"><span class="nav-number">4.</span> <span class="nav-text">代码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E5%8D%93keycode%E5%88%97%E8%A1%A8"><span class="nav-number">5.</span> <span class="nav-text">安卓keycode列表</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">vchao</p>
  <div class="site-description" itemprop="description">怀揣好奇，梦想改变世界的菜鸟极客</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">46</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">27</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        
  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">冀ICP备 17022751号-1 </a>
      <img src="https://beian.miit.gov.cn" style="display: inline-block;">
  </div>

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">vchao</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
